# !usr/bin/python
# -*-coding: utf-8-*
# FileName: BinaryTree_Sequence.py


class NODE:
	Value = None
	LNext = None
	RNext = None

	def __init__( self, data ):
		self.Value = data


def PrintMLR( tree ):
	if( tree == None ):
		return

	print( tree.Value )
	PrintMLR( tree.LNext )
	PrintMLR( tree.RNext )

def PrintLMR( tree ):
	if( tree == None ):
		return

	PrintLMR( tree.LNext )
	print( tree.Value )
	PrintLMR( tree.RNext )


def PrintLRM( tree ):
	if( tree == None ):
		return

	PrintLRM( tree.LNext )
	PrintLRM( tree.RNext )
	print( tree.Value )


root = NODE(0)
l_01 = NODE(900101)
r_01 = NODE(900102)
root.LNext = l_01
root.RNext = r_01

l_021 = NODE(900201)
r_021 = NODE(900202)
l_01.LNext = l_021
l_01.RNext = r_021

l_022 = NODE(900221)
r_022 = NODE(900222)
r_01.LNext = l_022
r_01.RNext = r_022


print("前序:")
PrintMLR( root )
print("中序:")
PrintLMR( root )
print("后序:")
PrintLRM( root )